<?php
class Crypt {
	var $strChar = "Aa8B1bCcDd9Ee2FfGg0HhIi3JjKkLlMm_Nn4OoPpQqRr5SsTtUuVv6WwXxYy7Zz.";
	function encrypt($iStrText){
		$strTemp="";
		for($i=0;$i<strlen($iStrText);$i++){
			$textChar = substr($iStrText,$i,1);
			$charPos = strpos($this->strChar,$textChar);
			$nextPos = $charPos + strlen($iStrText) + $i;
			
			$textChar = $nextPos >= strlen($this->strChar) ? substr($this->strChar,$nextPos - strlen($this->strChar),1) : substr($this->strChar,$nextPos,1);
			$strTemp .= $textChar;
		}
		return $strTemp;
	}
	
	function decrypt($iStrText){			
		$strTemp="";
		for($i=0;$i<strlen($iStrText);$i++){
			$textChar = substr($iStrText,$i,1);
			$charPos = strpos($this->strChar,$textChar);
			$nextPos = $charPos - (strlen($iStrText) + $i) < 0 ? strlen($this->strChar) - ((strlen($iStrText) + $i) - $charPos) : $charPos - (strlen($iStrText) + $i);
			
			$textChar = substr($this->strChar,$nextPos,1);
			$strTemp .= $textChar;
		}
		return $strTemp;
	}
}
?>